<?xml version="1.0" encoding="UTF-8" ?>
<%@page import="com.liao.mvc.domain.Customer"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
</head>
<body>
	<%
		Object msg = request.getAttribute("message");
		if (msg != null) {
	%>
	<br />
	<font color="red"><%=msg%></font>
	<br />
	<%
		}
		String id = null;
		String oldname = null;
		String name = null;
		String address = null;
		String phone = null;

		Customer customer = (Customer) request.getAttribute("customer");
		if (customer != null) {
			id = customer.getId() + "";
			oldname = customer.getName();
			name = customer.getName();
			address = customer.getAddress();
			phone = customer.getPhone();
		} else {
			id = request.getParameter("id");
			oldname = request.getParameter("oldname");
			name = request.getParameter("oldname");
			address = request.getParameter("address");
			phone = request.getParameter("phone");
		}
	%>



	<h1>更新一条新的customer信息</h1>
	<form action="update.do" method="post">

		<input type="hidden" name="id" value="<%=id%> " /> 
		<input type="hidden" name="oldname" value="<%=oldname%>" />
		<table>
			<tr>
				<td>CustomerName:</td>
				<td><input type="text" name="name" value="<%=name%>" /></td>
			</tr>
			<tr>
				<td>Address:</td>
				<td><input type="text" name="address" value="<%=address%>" /></td>
			</tr>
			<tr>
				<td>Phone:</td>
				<td><input type="text" name="phone" value="<%= phone %>" /></td>
			</tr>
			<tr>
				<td colspan="2"><input type="submit" value="UPDATE" /></td>

			</tr>
		</table>
	</form>
</body>
</html>